package com.zdsoft.groovy

import static org.junit.Assert.*

import org.codehaus.groovy.runtime.typehandling.NumberMath

/**
 * 
 * <p>类描述:</p>
 * @copyright www.zdsoft.cn
 * @author xingdaolin@msn.cn
 * @date  2016年11月30日
 * @version 1.0
 */
class Test1 {

	static main(args) {
		/**
		 * 基础指标项:base1=10,base2=3,base4=6,base5=5
		 * 衍生指标项:ybase1=(base1+base2)/2-(base4-base5)*0.3
		 * 					ybase2=|ybase1+base2-ybase1*1.5|
		 */
		def base1 = 10
		def base2 = 3
		def base4 = 6
		def base5 = 5
		def ybase1 = "${(base1+base2)/2-(base4-base5)*0.3}"
//		def ybase1 = "${base1.plus(base2).div(2)-base4.minus(base5).multiply(0.3)}"
		println(ybase1)
		println("${NumberMath.abs(-5)}")
		def tmp = "${ybase1+base2-ybase1*1.5}"
		def ybase2 = "${NumberMath.abs(tmp.toFloat())}"
		def cl={
			return ybase2;
		}
		println(ybase2)
		def test=[
			one:{println("one")},
			two:{println("ybase2="+cl())}
			] 
		test.two()
		test.one()
	}
	
}
interface Test{
	def one()
	def two()
}